package ch.sv7.tool.dbmanager.db.fixbuilder;

import ch.sv7.tool.dbmanager.Context;
import ch.sv7.tool.dbmanager.db.dialect.Dialect;
import ch.sv7.tool.dbmanager.db.difference.ConstraintDefinitionDifference;
import ch.sv7.tool.dbmanager.db.difference.SchemaDifference;
import ch.sv7.tool.dbmanager.db.fix.CreateConstraintFix;
import ch.sv7.tool.dbmanager.db.fix.DropConstraintFix;
import ch.sv7.tool.dbmanager.db.fix.SchemaFix;

/**
 * TODO: Document me!
 *
 * @author svt
 *
 */
public class ConstraintDefinitionFixBuilder implements FixBuilder {

	public SchemaFix[] createFixes(SchemaDifference difference, Dialect dialect, Context context) {
		ConstraintDefinitionDifference constraintDefinitionDifference = (ConstraintDefinitionDifference)difference;
		SchemaFix createFix = new CreateConstraintFix(constraintDefinitionDifference.getExpectedConstraintSchema());
		SchemaFix dropFix = new DropConstraintFix(constraintDefinitionDifference.getActualConstraintSchema());
		return new SchemaFix[]{ dropFix,  createFix};
	}

}
